local ninghan = fk.CreateSkill {
  name = "ninghan",
}

ninghan:addEffect("viewas", {
  card_filter =function (self, player, to_select, selected)
    return RoomInstance and table.find(RoomInstance.alive_players, function (p) return p:hasSkill(self) end) and
    Fk:getCardById(to_select).suit == Card.Club and Fk:getCardById(to_select).trueName == "slash" and
    table.contains(player.player_cards[Player.Hand], Fk:getCardById(to_select).id)
  end,
  view_as =function (self, player, cards)
    local card = Fk:cloneCard("ice__slash", Card.Club, Fk:getCardById(cards[1]).number)
    card.skillName = self.name
    return card
  end,
})
ninghan:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill("ninghan") and not target.dead and data.damageType == fk.IceDamage and data.card and
    player.room:getCardArea(data.card) == Card.Processing
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askForSkillInvoke(player, "ninghan", data, "#ninghan-invoke:::"..data.card:toLogString())
  end,
  on_use = function(self, event, target, player, data)
    player:addToPile("shacheng", data.card, true, "ninghan")
  end,
})
return ninghan